package com.learn.kotlinlearndemolist.derived

/**
 * author: ts
 * created on: 2025/2/11 上午9:31
 * description:
 */
class DerivedOverride {
    interface Base{
        val msg: String
        fun printMsg()
        fun printMsgLine()
    }

    class BaseImpl(val x: Int) : Base {
        override val msg: String
            get() = "BaseImpl: x = $x"
        override fun printMsg() {
            println(x)
        }
        override fun printMsgLine() {
            println(msg)
        }
    }

    class Derived(b: Base) : Base by b {
        override val msg: String
            get() = "Msg of Derived"
        override fun printMsg() {
            println("seven seven seven")
        }
    }
}